

// let axios = require('axios');

function loadImage(filepath) {
    return new Promise((resolve, reject) => {
        let img = new Image();
        img.src = filepath;
        img.onload = function () {
            console.log(`load ${filepath} success!`);
            resolve(img);
        };
        img.onerror = function () {
            console.error(`load ${filepath} error!`);
            reject(filepath);
        };
    });
}

module.exports = loadImage;
